<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Exception Diagnostic: collector.hpp Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Exception Diagnostic
   &#160;<span id="projectnumber">1.0.2</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">collector.hpp</div>  </div>
</div>
<div class="contents">
<a href="collector_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">    Copyright (c) 2010, Boris Sivko</span>
<a name="l00003"></a>00003 <span class="comment">    All rights reserved.</span>
<a name="l00004"></a>00004 <span class="comment"></span>
<a name="l00005"></a>00005 <span class="comment">    E-mail: bsivko@gmail.com (Boris Sivko)</span>
<a name="l00006"></a>00006 <span class="comment"></span>
<a name="l00007"></a>00007 <span class="comment">    This file is part of Exeption Diagnostic Library.</span>
<a name="l00008"></a>00008 <span class="comment"></span>
<a name="l00009"></a>00009 <span class="comment">    Redistribution and use in source and binary forms, with or without </span>
<a name="l00010"></a>00010 <span class="comment">    modification, are permitted provided that the following conditions are met:</span>
<a name="l00011"></a>00011 <span class="comment"></span>
<a name="l00012"></a>00012 <span class="comment">    Redistributions of source code must retain the above copyright notice, </span>
<a name="l00013"></a>00013 <span class="comment">    this list of conditions and the following disclaimer.</span>
<a name="l00014"></a>00014 <span class="comment"></span>
<a name="l00015"></a>00015 <span class="comment">    Redistributions in binary form must reproduce the above copyright notice, </span>
<a name="l00016"></a>00016 <span class="comment">    this list of conditions and the following disclaimer in the documentation </span>
<a name="l00017"></a>00017 <span class="comment">    and/or other materials provided with the distribution.</span>
<a name="l00018"></a>00018 <span class="comment"></span>
<a name="l00019"></a>00019 <span class="comment">    Neither the name of the Intervale nor the names of its contributors </span>
<a name="l00020"></a>00020 <span class="comment">    may be used to endorse or promote products derived from this software </span>
<a name="l00021"></a>00021 <span class="comment">    without specific prior written permission.</span>
<a name="l00022"></a>00022 <span class="comment"></span>
<a name="l00023"></a>00023 <span class="comment">    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; </span>
<a name="l00024"></a>00024 <span class="comment">    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, </span>
<a name="l00025"></a>00025 <span class="comment">    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE </span>
<a name="l00026"></a>00026 <span class="comment">    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE </span>
<a name="l00027"></a>00027 <span class="comment">    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL </span>
<a name="l00028"></a>00028 <span class="comment">    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR </span>
<a name="l00029"></a>00029 <span class="comment">    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER </span>
<a name="l00030"></a>00030 <span class="comment">    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, </span>
<a name="l00031"></a>00031 <span class="comment">    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE </span>
<a name="l00032"></a>00032 <span class="comment">    USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00033"></a>00033 <span class="comment">*/</span>
<a name="l00034"></a>00034 
<a name="l00040"></a>00040 <span class="preprocessor">#ifndef __EX_DIAG__COLLECTOR_HPP__INCLUDED</span>
<a name="l00041"></a>00041 <span class="preprocessor"></span><span class="preprocessor">#define __EX_DIAG__COLLECTOR_HPP__INCLUDED</span>
<a name="l00042"></a>00042 <span class="preprocessor"></span>
<a name="l00043"></a>00043 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00044"></a>00044 <span class="preprocessor">#include &lt;sstream&gt;</span>
<a name="l00045"></a>00045 
<a name="l00046"></a>00046 <span class="keyword">namespace </span>ex_diag {
<a name="l00047"></a>00047 
<a name="l00049"></a><a class="code" href="namespaceex__diag.html#a5f94d1505202abf6d4dc58a575af7f43">00049</a> <span class="keyword">const</span> std::string <a class="code" href="namespaceex__diag.html#a5f94d1505202abf6d4dc58a575af7f43" title="Default divide between different object dumps.">default_delimiter</a> = <span class="stringliteral">&quot;\n&quot;</span>;
<a name="l00050"></a>00050 
<a name="l00052"></a><a class="code" href="classex__diag_1_1collector__t.html">00052</a> <span class="keyword">class </span><a class="code" href="classex__diag_1_1collector__t.html" title="Collects info about failure.">collector_t</a>
<a name="l00053"></a>00053 {
<a name="l00054"></a>00054     <span class="keyword">public</span>:
<a name="l00056"></a>00056 
<a name="l00059"></a>00059         <a class="code" href="classex__diag_1_1collector__t.html#aba4b4a133002ba4fb578834c318849c8" title="Default ctor.">collector_t</a>();
<a name="l00060"></a>00060 
<a name="l00064"></a>00064         <a class="code" href="classex__diag_1_1collector__t.html#a97f1f448907bfd3c91837b40e7941a82">~collector_t</a>() <span class="keywordflow">throw</span>();
<a name="l00065"></a>00065 
<a name="l00067"></a>00067 
<a name="l00070"></a>00070         <span class="keywordtype">void</span>
<a name="l00071"></a>00071         <a class="code" href="classex__diag_1_1collector__t.html#a759cd525851d2517bed9c740b6a71785" title="Add info to collector.">add</a>( 
<a name="l00073"></a>00073             <span class="keyword">const</span> std::string &amp; <a class="code" href="classex__diag_1_1collector__t.html#a59248ff0167515d7619dcc70234a83f7" title="Get collected info.">info</a> );
<a name="l00074"></a>00074 
<a name="l00076"></a>00076 
<a name="l00079"></a>00079         std::string
<a name="l00080"></a>00080         <a class="code" href="classex__diag_1_1collector__t.html#a59248ff0167515d7619dcc70234a83f7" title="Get collected info.">info</a>();
<a name="l00081"></a>00081 
<a name="l00083"></a>00083         <span class="keywordtype">void</span>
<a name="l00084"></a>00084         <a class="code" href="classex__diag_1_1collector__t.html#af16783d372d99e3a95e28cac94971cde" title="Clear collected info.">clear</a>();
<a name="l00085"></a>00085 
<a name="l00087"></a>00087 
<a name="l00090"></a>00090         <span class="keywordtype">bool</span>
<a name="l00091"></a>00091         <a class="code" href="classex__diag_1_1collector__t.html#ac67dd923f7d028bbe18023489076320b" title="Have smth new info or not.">have_actual_info</a>() <span class="keyword">const</span>;
<a name="l00092"></a>00092 
<a name="l00094"></a>00094         <span class="keywordtype">void</span>
<a name="l00095"></a>00095         <a class="code" href="classex__diag_1_1collector__t.html#ac974b437d97a2549facb2f78e300fa99" title="Set delimiter at adding.">set_delimiter</a>( 
<a name="l00097"></a>00097             <span class="keyword">const</span> std::string &amp; delimiter );
<a name="l00098"></a>00098 
<a name="l00100"></a>00100 
<a name="l00103"></a>00103         <span class="keywordtype">void</span>
<a name="l00104"></a>00104         <a class="code" href="classex__diag_1_1collector__t.html#a6a40e26d7292de4c7522b78a392e1611" title="Get info from collector and dump according to the actual options.">dump</a>();
<a name="l00105"></a>00105 
<a name="l00107"></a>00107 
<a name="l00110"></a>00110         <span class="keywordtype">bool</span>
<a name="l00111"></a>00111         <a class="code" href="classex__diag_1_1collector__t.html#a573e31e676c6406876bd829b5c81a950" title="Empty collector or not.">empty</a>() <span class="keyword">const</span>;
<a name="l00112"></a>00112 
<a name="l00113"></a>00113     <span class="keyword">private</span>:
<a name="l00115"></a><a class="code" href="classex__diag_1_1collector__t.html#ae2d30b0641463d52ca17247e1e410f0d">00115</a>         <span class="keywordtype">bool</span> <a class="code" href="classex__diag_1_1collector__t.html#ae2d30b0641463d52ca17247e1e410f0d" title="All info was got or not.">m_have_actual_info</a>;
<a name="l00117"></a><a class="code" href="classex__diag_1_1collector__t.html#ab459a91615675135041b14fac69f4819">00117</a>         std::string <a class="code" href="classex__diag_1_1collector__t.html#ab459a91615675135041b14fac69f4819" title="All collected info.">m_info</a>;
<a name="l00119"></a><a class="code" href="classex__diag_1_1collector__t.html#ab8c26e3e9263d7072e5c592ba89c5661">00119</a>         std::string <a class="code" href="classex__diag_1_1collector__t.html#ab8c26e3e9263d7072e5c592ba89c5661" title="Delimiter between pieces of collection.">m_delimiter</a>;
<a name="l00120"></a>00120 };
<a name="l00121"></a>00121 
<a name="l00123"></a>00123 
<a name="l00127"></a>00127 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00128"></a>00128 <a class="code" href="classex__diag_1_1collector__t.html" title="Collects info about failure.">collector_t</a> &amp;
<a name="l00129"></a><a class="code" href="namespaceex__diag.html#a31aff70a2bd474c6a5be4536277f3761">00129</a> <a class="code" href="namespaceex__diag.html#a31aff70a2bd474c6a5be4536277f3761" title="Inserting into collector info about object.">operator &lt;&lt; </a>( <a class="code" href="classex__diag_1_1collector__t.html" title="Collects info about failure.">collector_t</a> &amp; c, <span class="keyword">const</span> T &amp; v )
<a name="l00130"></a>00130 {
<a name="l00131"></a>00131     std::stringstream buf;
<a name="l00132"></a>00132     buf &lt;&lt; v;
<a name="l00133"></a>00133     c.<a class="code" href="classex__diag_1_1collector__t.html#a759cd525851d2517bed9c740b6a71785" title="Add info to collector.">add</a>( buf.str() );
<a name="l00134"></a>00134 
<a name="l00135"></a>00135     <span class="keywordflow">return</span> c;
<a name="l00136"></a>00136 }
<a name="l00137"></a>00137 
<a name="l00139"></a>00139 
<a name="l00142"></a>00142 collector_t &amp;
<a name="l00143"></a>00143 <a class="code" href="namespaceex__diag.html#a75bc8c3fb3758ffec60b3110de44c491" title="Get default collector.">get_collector_instance</a>();
<a name="l00144"></a>00144 
<a name="l00145"></a>00145 } <span class="comment">/* namespace ex_diag */</span>
<a name="l00146"></a>00146 
<a name="l00147"></a>00147 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Tue Apr 30 2013 23:49:56 for Exception Diagnostic by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6
</small></address>

</body>
</html>
